package org.veridiandynamics.server.domain;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

/**
 * Doctors orders object which contains information about what a doctor prescribes a patient to do.
 *
 */
public class DoctorsOrders implements PersistObject, Serializable
{
	private String prescription;
	private String labWorkPerformed;
	private String followUpInstructions;
	private String otherInstructions;
	private long id;
	//private TreatmentRecord parent;
	
	private static final long serialVersionUID = 50L;
	
	/**
	 * Constructor that creates instance of DoctorsOrders with necessary information.
	 * 
	 * @param other Any other information to be stored.
	 * @param prescription
	 * @param labWork
	 * @param followUp
	 */
	public DoctorsOrders(String other, String prescription, String labWork,
			String followUp)
	{
		this.otherInstructions = other;
		this.prescription = prescription;
		this.labWorkPerformed = labWork;
		this.followUpInstructions = followUp;
	}
	
	/**
	 * Constructor that creates instance of doctors orders with less than all applicable information.
	 * 
	 * @param other
	 * @param prescription
	 */
	public DoctorsOrders(String other, String prescription)
	{
		this(other, prescription, null, "No followup specified");
	}
	
	/**
	 * Creates instance of orders where only a string is necessary for "other" 
	 * @param other
	 */
	public DoctorsOrders(String other)
	{
		this(other, "No prescription specified", null, "No followup specified");
	}
	
	/**
	 * Default constructor.
	 */
	public DoctorsOrders()
	{
		
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	public String toString()
	{
		String retVal = "Prescription: " + prescription + "\n" + "FollowUp: ";
		retVal += followUpInstructions + "\n" + "Otherinstructions: " +
				otherInstructions + "\n" + "Lab Work: " + labWorkPerformed;
		return retVal;
	}

	/**
	 * Returns the lab work pertaining to this set of orders.
	 * @return String of lab work if available.
	 */
	public String getLabWorkPerformed() {
		return labWorkPerformed;
	}

	/**
	 * Sets lab work pertaining to this set of orders.
	 * 
	 * @param labWorkPerformed String of lab work to be set.
	 */
	public void setLabWorkPerformed(String labWorkPerformed) {
		this.labWorkPerformed = labWorkPerformed;
	}

	/**
	 * Returns id.
	 * @return ID type long for this object.
	 */
	public long getId() {
		return id;
	}

	/**
	 * Sets id.
	 * @param id
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * Get prescription.
	 * @return String of Prescription contained in this instance of DoctorsOrders.
	 */
	public String getPrescription() {
		return prescription;
	}

	/**
	 * Set prescription.
	 * @param prescription String of Prescription contained in this instance of DoctorsOrders.
	 */
	public void setPrescription(String prescription) {
		this.prescription = prescription;
	}

	/**
	 * Gets follow up instructions.
	 * @return String of instructions
	 */
	public String getFollowUpInstructions() {
		return followUpInstructions;
	}

	/**
	 * Sets follow up instructions.
	 * @param followUpInstructions String of instructions.
	 */
	public void setFollowUpInstructions(String followUpInstructions) {
		this.followUpInstructions = followUpInstructions;
	}

	/**
	 * Gets other instructions.
	 * @return String of "other" field
	 */
	public String getOtherInstructions() {
		return otherInstructions;
	}

	/**
	 * Sets other instructions.
	 * @param otherInstructions String of "other" field
	 */
	public void setOtherInstructions(String otherInstructions) {
		this.otherInstructions = otherInstructions;
	}
	

	
	/**
	 * Writes object.
	 * 
	 * @param outputStream
	 * @throws IOException
	 */
	private void writeObject(ObjectOutputStream outputStream) throws IOException {
		outputStream.defaultWriteObject();
	}
	
	/**
	 * Reads object.
	 * 
	 * @param inputStream
	 * @throws ClassNotFoundException
	 * @throws IOException
	 */
	private void readObject(ObjectInputStream inputStream) throws ClassNotFoundException, IOException {
		inputStream.defaultReadObject();
	}
	
}
